package com.ruoyi.quartz.task;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ruoyi.patrol.constants.ReStatusEnum;
import com.ruoyi.patrol.domain.PtWorkPatrol;
import com.ruoyi.patrol.domain.PtWorkRepair;
import com.ruoyi.patrol.mapper.PtWorkPatrolMapper;
import com.ruoyi.patrol.mapper.PtWorkRepairMapper;
import com.ruoyi.patrol.service.IPtProjectService;
import com.ruoyi.patrol.service.IPtWorkPatrolService;
import com.ruoyi.patrol.service.IPtWorkRepairService;
import com.ruoyi.patrol.service.IPtWorkReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 定时器
 *
 * @author nan.li
 * @version JDK 8
 * @className MyTask
 * @date 2024/3/25
 * @description TODO
 */
@Component("myTask")
@Slf4j
public class MyTask {

    @Autowired
    private IPtWorkPatrolService patrolService;
    @Autowired
    private IPtWorkRepairService repairService;
    @Autowired
    private IPtWorkReportService reportService;

    public void updateStatus(){
        log.info("============定时更新数据状态：{}============", DateUtil.now());
        patrolService.updateByEndTime(ReStatusEnum.OVERTIME);
        repairService.updateByEndTime(ReStatusEnum.OVERTIME);
        reportService.updateByEndTime(ReStatusEnum.OVERTIME);
    }
}
